/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Current.Armory;

import Current.Armory.Items.SpyDefenseItems;

import java.io.Serializable;

/**
 * @author tiago
 */
public class SpyDefenseArmory implements Armory, Serializable, Cloneable {

    private SpyDefenseItems weapons;
    private SpyDefenseItems helms;
    private SpyDefenseItems armors;
    private SpyDefenseItems boots;
    private SpyDefenseItems bracers;
    private SpyDefenseItems shields;
    private Integer sentries;

    public SpyDefenseArmory(Integer sentries, SpyDefenseItems weapons, SpyDefenseItems helms, SpyDefenseItems armors, SpyDefenseItems boots, SpyDefenseItems bracers, SpyDefenseItems shields) {
        this.weapons = weapons;
        this.helms = helms;
        this.armors = armors;
        this.boots = boots;
        this.bracers = bracers;
        this.shields = shields;
        this.sentries = sentries;
    }

    public SpyDefenseArmory(Integer sentries) {
        this.weapons = new SpyDefenseItems(0, 12500, 25);
        this.helms = new SpyDefenseItems(0, 3000, 6);
        this.armors = new SpyDefenseItems(0, 9500, 19);
        this.boots = new SpyDefenseItems(0, 3000, 6);
        this.bracers = new SpyDefenseItems(0, 1500, 3);
        this.shields = new SpyDefenseItems(0, 6000, 12);
        this.sentries = sentries;
    }

    public SpyDefenseItems getWeapons() {
        return weapons;
    }

    public void setWeapons(SpyDefenseItems weapons) {
        this.weapons = weapons;
    }

    public SpyDefenseItems getHelms() {
        return helms;
    }

    public void setHelms(SpyDefenseItems helms) {
        this.helms = helms;
    }

    public SpyDefenseItems getArmors() {
        return armors;
    }

    public void setArmors(SpyDefenseItems armors) {
        this.armors = armors;
    }

    public SpyDefenseItems getBoots() {
        return boots;
    }

    public void setBoots(SpyDefenseItems boots) {
        this.boots = boots;
    }

    public SpyDefenseItems getBracers() {
        return bracers;
    }

    public void setBracers(SpyDefenseItems bracers) {
        this.bracers = bracers;
    }

    public SpyDefenseItems getShields() {
        return shields;
    }

    public void setShields(SpyDefenseItems shields) {
        this.shields = shields;
    }

    public int getSetSpyDefenseBonus() {
        int aux = 0;

        aux += this.weapons.getSpyDefenseBonus();
        aux += this.helms.getSpyDefenseBonus();
        aux += this.armors.getSpyDefenseBonus();
        aux += this.boots.getSpyDefenseBonus();
        aux += this.bracers.getSpyDefenseBonus();
        aux += this.shields.getSpyDefenseBonus();

        return aux;
    }

    private int getSpyDefenseFromWeapons() {
        if (this.weapons.getHave() >= sentries) {
            return this.weapons.getSpyDefenseBonus() * sentries;
        } else {
            return this.weapons.getSpyDefenseBonus() * this.weapons.getHave();
        }
    }

    private int getSpyDefenseFromHelms() {
        if (this.helms.getHave() >= sentries) {
            return this.helms.getSpyDefenseBonus() * sentries;
        } else {
            return this.helms.getSpyDefenseBonus() * this.helms.getHave();
        }
    }

    private int getSpyDefenseFromArmors() {
        if (this.armors.getHave() >= sentries) {
            return this.armors.getSpyDefenseBonus() * sentries;
        } else {
            return this.armors.getSpyDefenseBonus() * this.armors.getHave();
        }
    }

    private int getSpyDefenseFromBoots() {
        if (this.boots.getHave() >= sentries) {
            return this.boots.getSpyDefenseBonus() * sentries;
        } else {
            return this.boots.getSpyDefenseBonus() * this.boots.getHave();
        }
    }

    private int getSpyDefenseFromBracers() {
        if (this.bracers.getHave() >= sentries) {
            return this.bracers.getSpyDefenseBonus() * sentries;
        } else {
            return this.bracers.getSpyDefenseBonus() * this.bracers.getHave();
        }
    }

    private int getSpyDefenseFromShields() {
        if (this.shields.getHave() >= sentries) {
            return this.shields.getSpyDefenseBonus() * sentries;
        } else {
            return this.shields.getSpyDefenseBonus() * this.shields.getHave();
        }
    }

    public int getTotalSpyDefenseBonus() {
        int aux = 0;

        aux += getSpyDefenseFromWeapons();
        aux += getSpyDefenseFromHelms();
        aux += getSpyDefenseFromArmors();
        aux += getSpyDefenseFromBoots();
        aux += getSpyDefenseFromBracers();
        aux += getSpyDefenseFromShields();

        return aux;
    }

    public int getSetCost() {
        int aux = 0;

        aux += this.weapons.getCostToBuy();
        aux += this.helms.getCostToBuy();
        aux += this.armors.getCostToBuy();
        aux += this.boots.getCostToBuy();
        aux += this.bracers.getCostToBuy();
        aux += this.shields.getCostToBuy();

        return aux;
    }

    public Integer getSentries() {
        return sentries;
    }

    public void setSentries(Integer sentries) {
        this.sentries = sentries;
    }
}
